﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DPS.DataModel;

namespace DPS.Prototype.Model.Adapter
{
    public class CapacityAdapter
    {
        public static Capacity Adapter(DPSUPHByBatchT UPH)
        {
            Capacity capacity = new Capacity();
            capacity.ProductTime = (DateTime)UPH.ProductDate;
            capacity.SortNo = UPH.SortNo;
            capacity.Shift = ConvertShift(UPH.Shift);
            capacity.StartTime = (DateTime)UPH.BeginTime;
            capacity.EndTime = (DateTime)UPH.EndTime;
            capacity.UPH = (float)UPH.UPH;
            return capacity;
        }

       
        private static Shift ConvertShift(string strShift)
        {
            Shift shift = Shift.Day;
            try
            {
                shift = (Shift)Enum.Parse(typeof(Shift), strShift, true);

            }
            catch (Exception ex)
            {
            }
            return shift;
        }

    }
}
